<%--
  Created by IntelliJ IDEA.
  User: jiangmingliang
  Date: 2020/4/7
  Time: 9:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册</title>
<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
<style type="text/css">
    div{
        width:300px;
        border: 1px solid red;
        margin: 20px auto;
        padding: 20px;
    }
</style>
<script type="text/javascript">
    function getCode(){

        $.post('SmsServlet','phone='+$('#phone').val(),function(data){
            console.log(data);
            if("1" == data){
                alert('短信已发出');
            } else {
                alert('无法发送短信');
            }
        })
    }
</script>
</head>
<body>
<div>
    <h2>普通注册</h2>
    <form action="RegisterByUsernameServlet" method="post">
        用户名：<input type="text" name="login_name" />
        <br/>
        密码：<input type="password" name="password" />
        <br/>
        <input type="submit" value="提交"/>
    </form>
</div>

<div>
    <h2>邮箱注册</h2>
    <form action="RegisterByEmailServlet" method="post">
        用户名：<input type="text" name="login_name" />
        <br/>
        Email：<input type="text" name="email" />
        <br/>
        密码：<input type="password" name="password" />
        <br/>
        <input type="submit" value="提交"/>
    </form>
</div>


<div>
    <h2>手机注册</h2>
    <form action="RegisterByPhoneServlet" method="post">
        用户名：<input type="text" name="login_name" />
        <br/>
        手机号：<input type="text" name="phone" id="phone"/>
        <br/>
        验证码：<input type="text" name="code" /> <input type="button" value="获取验证码" onclick="getCode();" />
        <br/>
        密码：<input type="password" name="password" />
        <br/>
        <input type="submit" value="提交"/>
    </form>
</div>
</body>
</html>
